<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>demo</title>
    <link rel="stylesheet" href="../static/layui/css/layui.css">
</head>
<body>
<div class="layui-container" style="width: 100%;">
    <div class="layui-row">
        <form class="layui-form" lay-filter="form1">
            <div class="layui-form-item layui-inline">
                <input class="layui-input" placeholder="病人名" name="userName">
            </div>
            <div class="layui-form-item layui-inline">
                <input class="layui-input" placeholder="病人身份证" name="userAccount">
            </div>
            <div class="layui-form-item layui-inline">
                <input class="layui-input" placeholder="预约时间" name="orderTime" id="orderTime" autocomplete="off">
            </div>
            <div class="layui-form-item layui-inline">
                <select class="layui-form-select" name="status" id="status">
                    <option value="02" selected class="layui-this">审核通过</option>
                    <option value="03">审核不通过</option>
                    <option value="04">已完结</option>
                </select>
            </div>
            <div class="layui-form-item layui-inline" style="float: right;">
                <button class="layui-btn" type="button" onclick="table1Search()">查询</button>
            </div>
        </form>
    </div>
    <div class="layui-row">
        <table id="table1" class="layui-table" lay-filter="table1"></table>
    </div>
    <div class="layui-row">

    </div>
</div>
</body>
<script type="text/javascript" src="../static/layui/layui.all.js"></script>
<script type="text/javascript" src="../static/config.js"></script>
<script type="text/javascript">
    const $ = layui.$;
    const element = layui.element;
    const layer = layui.layer;
    const form = layui.form;
    const table = layui.table;
    const laydate = layui.laydate;

    laydate.render({
        elem: "#orderTime",
        value: new Date(),
        type: "date"
    });

    const options = {
        elem: '#table1',
        url: baseUrl + "/hospital-doctor/order/getOrderDetailByDoctorId",
        headers: {
            "x-token": localStorage.getItem("x-token")
        },
        height: 700,
        method: "post",
        even: true,
        page: true,
        cols: [[
            {type: 'numbers', title: '序号', width: 44},
            {field: 'objId', title: '主键', hide: true},
            {field: 'status', title: '状态'},
            {field: 'userAccount', title: '病人身份证'},
            {field: 'userName', title: '病人名'},
            {field: 'doctorName', title: '医生名'},
            {field: 'orderTime', title: '预约时间'},
            {field: 'createTime', title: '创建时间'},
            {field: 'careResult', title: '治疗结果'},
            {field: 'carePropose', title: '治疗建议'},
            {field: 'cost', title: '消费'},
            {field: 'isBed', title: '是否需要住院'},
            {field: 'isOperation', title: '是否需要手术'},
            {field: 'bed', title: '床位',},
            {field: 'operationTime', title: '手术时间'},
            {field: 'remark', title: '备注'}
        ]],
        where: {
            status: "02",
            orderTime: getTodayDate()
        }
    }

    $("#orderTime").val(getTodayDate());

    const table1 = table.render(options);

    function table1Search() {
        table1.reload({
            where: form.val("form1"),
            page: {
                curr: 1
            }
        });
    }

    table.on('rowDouble(table1)', function (obj) {
        obj = obj.data;
        parent.layer.open({
            type: 2,
            content: 'frame/care.html?objId=' + obj.objId,
            area: ['870px', '88%'],
            title: '处理',
            end: function () {
                table1.reload();
            }
        });

    });

</script>
</html>